import axios, { ResponseData } from 'yuxin-base/src/utils/axios'

export function setBuildingFloor (projectId, data: any, reset = false): Promise<ResponseData> {
	return axios.request({
		url: `/saas-rental-property/property/project/building/${projectId}/${reset}`,
		data,
		method: 'POST'
	})
}

export function getBuildingFloor (projectId, params = {}): Promise<ResponseData> {
	return axios.request({
		url: `/saas-rental-property/property/project/building/tree/${projectId}`,
		params,
		method: 'GET'
	})
}

export function getHouseType (projectId): Promise<ResponseData> {
	return axios.request({
		url: `/saas-rental-property/property/house_type/${projectId}`,
		method: 'GET'
	})
}

export function addHouseType (projectId, data): Promise<ResponseData> {
	return axios.request({
		url: `/saas-rental-property/property/house_type/${projectId}`,
		data,
		method: 'POST'
	})
}

export function updateHouseType (projectId, data, houseTypeId): Promise<ResponseData> {
	return axios.request({
		url: `/saas-rental-property/property/house_type/${projectId}/${houseTypeId}`,
		data,
		method: 'PUT'
	})
}

export function delHouseType (projectId, houseTypeId): Promise<ResponseData> {
	return axios.request({
		url: `/saas-rental-property/property/house_type/${projectId}/${houseTypeId}`,
		method: 'DELETE'
	})
}

export function postSingleRooms (projectId, data): Promise<ResponseData> {
	return axios.request({
		url: `/saas-rental-property/property/command/centralized_whole_property/${projectId}`,
		data,
		method: 'POST'
	})
}

export function postWholeRooms (projectId, data): Promise<ResponseData> {
	return axios.request({
		url: `/saas-rental-property/property/command/whole_property/${projectId}`,
		data,
		method: 'POST'
	})
}

export function postPartRooms (projectId, data): Promise<ResponseData> {
	return axios.request({
		url: `/saas-rental-property/property/command/share_property/${projectId}`,
		data,
		method: 'POST'
	})
}

export function delHouse (propertyId) {
	return axios.request({
		url: `/saas-rental-property/property/command/${propertyId}`,
		method: 'DELETE'
	})
}

export function getViewsProject (projectId, params) {
	return axios.request({
		url: `/saas-rental-property/property/view/floor/${projectId}`,
		params,
		method: 'GET'
	})
}

export function getWholeHouse (projectId, floorId, params) {
	return axios.request({
		url: `/saas-rental-property/property/view/whole_property/${projectId}/${floorId}`,
		params,
		method: 'GET'
	})
}

export function getPartHouse (projectId, floorId, params) {
	return axios.request({
		url: `/saas-rental-property/property/view/share_property/${projectId}/${floorId}`,
		params,
		method: 'GET'
	})
}

export function getSingleHouse (projectId, floorId, params) {
	return axios.request({
		url: `/saas-rental-property/property/view/centralized_whole_property/${projectId}/${floorId}`,
		params,
		method: 'GET'
	})
}

export function getProjectDetail (projectId) {
	return axios.request({
		url: `/saas-rental-property/property/project/${projectId}`,
		method: 'GET'
	})
}

export function setHouseType (data) {
	return axios.request({
		url: `/saas-rental-property/property/command/property/house_type`,
		data,
		method: 'POST'
	})
}

export function getRentCount (projectId, params) {
	return axios.request({
		url: `/saas-rental-property/property/view/count/${projectId}`,
		params,
		method: 'GET'
	})
}

export function addShareProperty (mainPropertyId, data) {
	return axios.request({
		url: `/saas-rental-property/property/command/share_property/child/${mainPropertyId}`,
		data,
		method: 'POST'
	})
}

export function getHouseTypeCount (projectId, propertyType, floorIds) {
	return axios.request({
		url: `/saas-rental-property/property/view/house_type/${projectId}/${propertyType}/${floorIds}`,
		method: 'GET'
	})
}


export function getName (floorId) {
	return axios.request({
		url: `/saas-rental-property/property/command/getName/${floorId}`,
		method: 'GET'
	})
}

export function checkName (floorId, names) {
	return axios.request({
		url: `/saas-rental-property/property/command/checkName/${floorId}/${names} `,
		method: 'GET'
	})
}
